<template>
	<view class="introduce">
		<view class="content">
			<view v-if="video" class="video_img">
				<video id="videoRef" :style="{'height': videoHeight+'px'}" :src="video"></video>
			</view>
			<image v-else mode="widthFix" :src="baseUrl+info.image"></image>
			<view class="right">
				<view class="title">
					{{ info.title }}
				</view>
				<view class="name">
					{{ info.name }}
				</view>
				<view class="desc">
					{{ info.desc }}
				</view>
				<view class="more" v-if="info.more != false">
					Load More <image mode="widthFix" style="width: 20px; margin-left: 10px;" src="@/static/more1.png">
					</image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import config from '@/config/config.js'
	export default {
		props: {
			info: {
				type: Object,
				default: () => {}
			},
			video: {
				type: String,
				default: ''
			},
			videoUrl: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				baseUrl: config.baseUrl,
				videoSrc: '',
				videoHeight: 0,
			}
		},
		created() {
			this.$nextTick(() => {
				this.setVideo()
			})
		},
		methods: {
			setVideo() {
				let that = this
				uni.createSelectorQuery().in(this).select('#videoRef').fields({
					size: true
				}, res => {
					if(res) that.videoHeight = parseInt(res.width * 0.56)
				}).exec()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.introduce {
		padding: 3vw 0;

		.content {
			width: 90%;
			margin: 0 auto;
			display: flex;
			justify-content: space-between;

			image {
				width: 40%;
			}

			.video_img {
				width: 40%;
				height: fit-content;
				position: relative;

				video {
					width: 100%;
				}
			}

			.right {
				width: 58%;

				.title {
					font-size: 45px;
					font-family: Arial-BoldMT-, Arial-BoldMT;
					font-weight: normal;
					color: #4864A7;
				}

				.name {
					font-size: 30px;
					font-family: PingFang SC-Semibold, PingFang SC;
					font-weight: 600;
					color: #231815;
					margin: 10px 0;
				}

				.desc {
					font-size: 16px;
					font-family: MicrosoftYaHei-, MicrosoftYaHei;
					font-weight: normal;
					color: #000000;
					white-space: pre-wrap;
					line-height: 30px;
				}

				.more {
					font-size: 16px;
					font-family: Arial-BoldMT-, Arial-BoldMT;
					font-weight: normal;
					color: #4864A7;
					margin-top: 40px;
					display: flex;
					align-items: center;
				}
			}
		}
	}

	.popup-content {
		position: relative;

		video {
			width: 60vw;
			max-width: 900px;
		}

		.close {
			position: absolute;
			left: calc(50% - 20px);
			bottom: -60px;
			width: 40px;
			height: 40px;
			cursor: pointer;
		}
	}
</style>